package hibernate.roomSystem;

import hibernate.p.Pair;
import hibernate.p.Unit;

import java.util.Set;
import java.util.StringTokenizer;

import hibernate.billStream.ServiceWrapper;

public class RoomType {

	private SizeAndFacilities sizeAndFacilities;
	private Facing facing;
	private Speciality speciality;
	private Pair pricePerDay=new Pair();
	private boolean partTimeAllowed;
	private Pair pricePerHour=new Pair();
	private int floor;
	private Set<ServiceWrapper> servicesAvaliable;
	private Long id;
	private Room room;
	
	public Room getRoom(){return room;}
	
	public void setRoom(Room room){this.room=room;}
	
	public Pair getPricePerDayObj(){return pricePerDay;}
	
	public Pair getPricePerHourObj(){return pricePerHour;}
	
	public void setId(Long id){this.id=id;}
	
	public Long getId(){return id;}
	
	public Object match(){
		return null;
	}
	
	public void setSizeAndFacilities(String sizeAndFac){
		sizeAndFacilities=SizeAndFacilities.getInstance(sizeAndFac);
	}
	
	public String getSizeAndFacilities(){
		return sizeAndFacilities.toString();
	}
	
	public void setFacing(String face){
		System.out.println(face);
		facing=Facing.getInstantce(face);
	}
	
	public String getFacing(){
		return facing.toString();
	}
	
	public void setSpeciality(String speciality){
		this.speciality=Speciality.getInstance(speciality);
	}
	
	public String getSpeciality(){
		return speciality.toString();
	}
	
	public Double getPricePerDay(){
		return ((Double)pricePerDay.getFirst()).doubleValue();
	}
	
	public void setPricePerDay(Double info){
		this.pricePerDay.setFirst(info);
	}
	
	public String getPricePerDayUnit(){
		return ((Unit)this.pricePerDay.getSecond()).toString();
	}
	
	public void setPricePerDayUnit(String unit){
		this.pricePerDay.setSecond(Unit.parseUnit(unit));
	}
	
	public void setPartTimeAllowed(boolean ifPartTimeAllowed){
		partTimeAllowed=ifPartTimeAllowed;
	}
	
	public boolean getPartTimeAllowed(){
		return partTimeAllowed;
	}
	
	public Double getPricePerHour(){
		if(pricePerHour == null || pricePerHour.getFirst() == null)
			return new Double(0);
		return ((Double)pricePerHour.getFirst()).doubleValue();
	}
	
	public void setPricePerHour(Double info){
		this.pricePerHour.setFirst(info);
	}
	
	public String getPricePerHourUnit(){
		if(pricePerHour == null || pricePerHour.getSecond() == null)
			return "";
		return ((Unit)this.pricePerHour.getSecond()).toString();
	}
	
	public void setPricePerHourUnit(String unit){
		this.pricePerHour.setSecond(Unit.parseUnit(unit));
	}
	
	public int getFloor(){
		return floor;
	}
	
	public void setFloor(int floor){
		this.floor=floor;
	}
	
	public void setServicesAvaliable(Set<ServiceWrapper> set){
		servicesAvaliable=set;
	}
	
	public Set<ServiceWrapper> getServicesAvaliable(){
		return servicesAvaliable;
	}
	
	public boolean equals(Object obj){
		if(!(obj instanceof RoomType))
			return false;
		else 
			return this.id.equals(((RoomType)obj).id);
	}
}
